package com.sanshow.charging.util;

import android.text.TextUtils;

import com.google.gson.Gson;
import com.sanshow.charging.gson.DeviceInfo;
import com.sanshow.charging.gson.LoginInfo;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class Utility {


    public static DeviceInfo handleDeviceInfoResponse(String response) {
        try {
            /*JSONObject jsonObject = new JSONObject(response);
            JSONArray jsonArray = jsonObject.getJSONArray("");*/
            return new Gson().fromJson(response, DeviceInfo.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static LoginInfo handleLoginInfoResponse(String response) {
        try {
            return new Gson().fromJson(response, LoginInfo.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static UpdateInfo handleAppUpgradeInfoResponse(String response) {
        try {
            return new Gson().fromJson(response, UpdateInfo.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
